<template>
  <div>
    <el-config-provider :locale="zhCn">
      <router-view />
    </el-config-provider>
  </div>
</template>

<script>
import { ElConfigProvider } from 'element-plus';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import { req_logout } from './api/index'; 
import { response2ElMessage } from './utils/response-utils'; 
export default {
  data() {
    return {
      zhCn: zhCn, 
    };
  },
  methods: {
    async logout() {
      try {
        let response = await req_logout();
        let data = response.data;
        if (data['errno'] === 1) {
          this.$store.commit('clearUser');
        }
        response2ElMessage(response);
      } catch (error) {
        console.error('注销失败：', error);
      }
    },
  },
  mounted() {
    this.$store.dispatch('userGet');
  },
};
</script>

<style>
@import './assets/css/main.css';
@import './assets/css/color-dark.css';
</style>
